<script setup lang="ts">
import type { FormDesignerComponents } from "../FormComponentMixin";
import CommonConfig from "./CommonConfig.vue";
const config = defineModel<FormDesignerComponents>("config");
const propsCollapse = ref("0");
</script>

<template>
  <el-collapse v-model="propsCollapse" accordion>
    <el-collapse-item name="0">
      <template #title>
        <div class="collapse-title">
          <el-icon color="#1890ff"><List /></el-icon>
          <div>基本属性</div>
        </div>
      </template>
      <CommonConfig v-model:config="config" />
      <el-form-item label="是否必填">
        <el-switch v-model="config.props.required" />
      </el-form-item>
      <el-form-item label="文件大小">
        <el-input-number
          v-model="config.props.size"
          placeholder="单个文件最大大小(MB)"
        />
      </el-form-item>
      <el-form-item label="文件个数">
        <el-input-number
          v-model="config.props.limit"
          placeholder="可上传的文件个数"
        />
      </el-form-item>
      <el-form-item label="上传文件">
        <el-checkbox-group
          v-model="config.props.accept"
          placeholder="允许上传的文件格式"
        >
          <el-checkbox label="pdf" value=".pdf" />
          <el-checkbox label="doc" value=".doc" />
          <el-checkbox label="docx" value=".docx" />
          <el-checkbox label="xls" value=".xls" />
          <el-checkbox label="xlsx" value=".xlsx" />
          <el-checkbox label="jpg" value=".jpg" />
          <el-checkbox label="jpeg" value=".jpeg" />
          <el-checkbox label="png" value=".png" />
          <el-checkbox label="bmp" value=".bmp" />
        </el-checkbox-group>
      </el-form-item>
    </el-collapse-item>
  </el-collapse>
</template>

<style lang="scss" scoped>
.collapse-title {
  padding: 0px 5px;
  display: flex;
  align-items: center;

  & > div {
    margin-left: 10px;
  }
}
</style>
